{smcl}
{* 20 August 2002}{...}
{hline}
help for {hi:labmask}
{hline}

{title:Assign values or value labels of one variable as value labels to another}

{p 4 10 2}
{cmd:labmask} 
{it:varname}
[{cmd:if} {it:exp}]
[{cmd:in} {it:range}]
{cmd:,} 
{cmdab:val:ues}{cmd:(}{it:varname}{cmd:)} 
[ 
{cmdab:lbl:name}{cmd:(}{it:lblname}{cmd:)} 
{cmd:decode}
] 


{title:Description}

{p 4 4 2}{cmd:labmask} assigns the values (or optionally the value labels) of
one variable {it:values} as the value labels of another variable {it:varname}.
Any existing value labels will be overwritten. The idea behind the program name
is that henceforth the face that {it:varname} presents will not be its own, but
a mask borrowed from {it:values}. Thus, for example, a year variable might be
coded by party winning at election and those value labels then shown as labels
on a graph axis. 

{p 4 4 2}{it:varname} must take on integer values for the observations
selected. {it:values} must not vary within groups defined by the distinct
values of {it:varname} for the observations selected. However, there is no rule
that the same label may not be assigned to different values of {it:varname}. 
 

{title:Options}

{p 4 8 2}{cmd:values(}{it:varname}{cmd:)} specifies a variable whose values (by
default) or value labels (optionally) will be used as the value labels of
{it:varname}. This is a required option. 
 
{p 4 8 2}{cmd:lblname(}{it:lblname}{cmd:)} specifies that the value labels to
be defined will have the label name {it:lblname}. The default is that they will
have the same name as {it:varname}. 
 
{p 4 8 2}{cmd:decode} specifies that the value labels of {it:values} should be
used as the value labels of {it:varname}. The default is to use the values of
{it:varname}. 


{title:Examples}

{p 12 12 2}{inp:. egen order = rank(-mpg), unique}{break} 
{inp:. labmask order, val(make)}{break}
{inp:. label var order "Make and Model"}{break}
{inp:. tabdisp order, c(mpg)}{break}
{inp:. tabdisp order foreign, c(mpg)} 


{title:Author} 

         Nicholas J. Cox, University of Durham, U.K.
         n.j.cox@durham.ac.uk


{title:Also see}

 Manual:  {hi:[U] 15.6.3 Value labels}, {hi:[R] label}  
{p 0 19}On-line:  help for {help label}; {help limits}{p_end}

